package study04;

import java.util.ArrayList;

public class Java01_collection_list {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add("zs");
        list.add("ls");
        list.add("ww");
        System.out.println(list);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        for (Object obj: list) {
            System.out.println(obj);
        }

//        list.set 的返回值就是旧的那个值
        Object oldvalue = list.set(0, "张三");
        System.out.println(oldvalue); // zs
        System.out.println(list);

//        list.remove 的返回值就是旧的那个值
        Object removeValue = list.remove(1);
        System.out.println(removeValue); // ls
        System.out.println(list);
    }
}
